public class Find_su{
    public static void main(String[] args){
        int N = 20001;
        int [] num = new int[N];
        for (int i = 2; i < N; i++)
        {
            num[i] = 1;
        }
        for(int i = 2; i < N; i++)
        {
            if (num[i] == 1)
            {
                for(int j = i; i*j < N; ++j)
                    num[i*j] = 0;                
            }
        }
        int []temp = new int[5];
        int count = 0;
        for (int i = 0; i < N; i++)
        {
            if(num[i] == 1)
            {
                temp[count] = i;
                count++;
            }
            if(count == 5)
            {
                for(int j = 0; j < 5; j++)
                {
                    System.out.print(temp[j]+" ");
                }
                System.out.print("\n");
                count = 0;
            }            
        }
    }
}